package lab1;

import java.util.ArrayList;

public class Meal {
    ArrayList<Item> items = new ArrayList<>();

    public void addItem(Item item){
        items.add(item);
    }

    public float calculatePrice(){
        float sum = 0;
        for (Item i: items){
            sum+= i.getPrice();
        }
        return sum;
    }

    public void print(){
        String s = "当前配菜：";
        for (Item i: items){
            s+=(" "+i.getItemName());
        }
        System.out.println(s);
    }

    public ArrayList<Item> getItems(){
        return items;
    }
}
